#include<iostream>
using namespace std;

double add(double,double);

double subtract(double,double);

double multiply(double,double);

double calculate(double,double,double (*function)(double,double));

int main()
{   
    double (*pf[3]) (double,double) = {add,subtract,multiply};
    double a,b;
    cout << "Enter two number of a and b:";
    while ( cin >> a >> b)
    {
        for ( int i = 0; i < 3; i++)
        cout << "a and b calculate is:" << calculate(a,b,*pf[i]) << endl;
        cout << "Enter again(q to quit):";
    }

    return 0;
}

double add(double x,double y)
{
    return x + y;
}

double subtract(double x,double y)
{
    return x - y;
}

double multiply(double x,double y)
{
    return x * y;
}

double calculate(double x,double y,double (*function)(double,double))
{
    return (*function)(x,y);
}